<?php 
namespace app\Index\controller;
use think\Controller;
use think\Request;
use app\index\model\Recharge;
use app\index\model\Customer;
class Rechargec extends Base
{
    //发布公告
    public function recharge_artifical(){
        if(Request::instance()->isPost()){
            $worker = input("post.worker");
            $uid = input("post.uid");
            $amount = input("post.amount");
            $attach = input("post.attach");

            $customer = new Customer();
            $customer_check = $customer -> check_customer($uid);
            if($customer_check["status"] == 1){
                $customer_info = $customer -> search_customer($uid);
                $cardnum = $customer_info["data"][0]["cardnum"];
                $recharge = new Recharge();
                $data = $recharge -> recharge_artifical($cardnum, $amount, $attach, $worker);
                if($data > 0){
                    return json(array("status"=>1, "message"=>"操作成功！", "data"=>$data));
                }else{
                    return json(array("status"=>0, "message"=>"操作失败！", "data"=>[$data]));
                }
            }else{
                return json(array("status"=>-1, "message"=>"操作失败！", "data"=>[$customer_check]));
            }
        }
    }
}